import bpy


addon_keymaps = []


class C_窗口事件处理(bpy.types.Operator):
	bl_idname = "scene.draw_mouse"
	bl_label = "鼠标事件"
	#bl_options = {'REGISTER', 'UNDO'}
	
	def execute(self, context):
		print('mouse event')
		return {'FINISHED'}



def register():
	bpy.utils.register_class(C_窗口事件处理)


	wm = bpy.context.window_manager
	km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY')#LEFTMOUSE key_modifier='MOUSEMOVE', 
	
	#kmi = km.keymap_items.new(C_窗口事件处理.bl_idname, type='MOUSEMOVE', value='PRESS', key_modifier='MOUSEMOVE')
	kmi = km.keymap_items.new(C_窗口事件处理.bl_idname, type='MOUSEMOVE', value='PRESS') #, ctrl=True, shift=True
	#kmi.properties.total = 4

	addon_keymaps.append((km, kmi))


def unregister():
	for km, kmi in addon_keymaps:
		km.keymap_items.remove(kmi)

	bpy.utils.unregister_class(C_窗口事件处理)



	